<template>
  <div class="paySuccess">
    <div class="paySuccessImg">
      <div class="paySuccessImgCenter">
        <div><img src="/static/images/pay/paymoneysuccess.png"></div>
        <p>支付成功</p>
      </div>
    </div>
    <div class="buyName">
      <div class="buyNameDiv">
        <div>脑卫士</div>
        <p>美豆<span>{{allIntegral}}</span></p>
      </div>
    </div>
    <div class="btnDiv">
      <p @click="toPersopnCenter">完成</p>
    </div>
  </div>
</template>
<script>
import {mapGetters} from 'vuex'
export default {
  data(){
    return {
      allIntegral: '',
    }
  },
  onLoad(option){
    this.allIntegral = option.allIntegral
  },
  computed:{
    ...mapGetters({
      currentProductCar: 'currentProductCar',
    }),
    selectedLineItems () {
      if (this.currentProductCar == null) {
        return []
      }
      return this.currentProductCar.filter((lineItem) => {
        if (lineItem.isSelected) {
          return true
        } else {
          return false
        }
      })
    },
  },
  onShow(){
    this.clearShopCar()
  },
  methods:{
    toPersopnCenter(){
      const url = "../allorders/main?aid="+1;
      wx.redirectTo({ url }) 
    },
    clearShopCar(){
      this.$store.dispatch("clearCurrentProductCar",this.selectedLineItems) //清除当前选中的商品
    }
  }
}
</script>
<style scoped>
.paySuccess{
  padding: 0 30rpx;
  overflow: hidden;
}
.paySuccess .paySuccessImg{
  display: flex;
  justify-content: center;
  margin-top: 30rpx;
}
.paySuccess .paySuccessImg .paySuccessImgCenter div{
  width: 92rpx;
  height: 92rpx;  
  margin: 0 auto;
}
.paySuccess .paySuccessImg .paySuccessImgCenter div img{
  width: 100%;
  height: 100%;
  display: block;
}
.paySuccess .paySuccessImg .paySuccessImgCenter p{
  font-size: 34rpx;
  color: #1aad19;
  margin-top: 25rpx;
}
.paySuccess .buyName{
  font-size: 34rpx;
  color: #353535;
  display: flex;
  justify-content: center;
  text-align: center;
  margin-top: 125rpx;
  margin-bottom: 485rpx;
}
.paySuccess .buyName p{
  font-size: 40rpx;
  color: #353535;
  display: flex;
  align-items: center;
  margin-top: 10rpx;
}
.paySuccess .buyName p span{
  font-size: 80rpx;
  color: #353535;
  font-weight: 600;
  margin-left: 20rpx;
}
.paySuccess .btnDiv{
  display: flex;
  justify-content: center;
  align-items: center;
}
.paySuccess .btnDiv p{
  width: 324rpx;
  height: 70rpx;
  box-sizing: border-box;
  border: 1px solid #1aad19;
  border-radius: 5rpx;
  font-size: 34rpx;
  color: #1aad19;
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
